package cn.iocoder.yudao.module.shop.dal.mysql.shopTable;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.shopTable.ShopTableDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.shopTable.vo.*;

/**
 * 商户桌号 Mapper
 *
 * @author 吕小文
 */
@Mapper
public interface ShopTableMapper extends BaseMapperX<ShopTableDO> {

    default PageResult<ShopTableDO> selectPage(ShopTablePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopTableDO>()
                .eqIfPresent(ShopTableDO::getBrandId, reqVO.getBrandId())
                .eqIfPresent(ShopTableDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopTableDO::getTableNo, reqVO.getTableNo())
                .eqIfPresent(ShopTableDO::getMaxPerson, reqVO.getMaxPerson())
                .eqIfPresent(ShopTableDO::getTableType, reqVO.getTableType())
                .eqIfPresent(ShopTableDO::getIsUse, reqVO.getIsUse())
                .eqIfPresent(ShopTableDO::getSeatStatus, reqVO.getSeatStatus())
                .betweenIfPresent(ShopTableDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(ShopTableDO::getTableNo)
                .orderByDesc(ShopTableDO::getId));
    }

    default List<ShopTableDO> selectByShopId(Long shopId){
        LambdaQueryWrapperX<ShopTableDO> queryWrapperX = new LambdaQueryWrapperX<>();
        queryWrapperX.eq(ShopTableDO::getShopId,shopId);
        return selectList(queryWrapperX);
    };
}